<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Biometric Embedded Platform: req_interface/inc/fpc_sensor_spi.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Biometric Embedded Platform
   &#160;<span id="projectnumber">fpc_bep_kaadas_21.0.1.002</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('fpc__sensor__spi_8h.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">fpc_sensor_spi.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Driver for SPI master.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;stdint.h&gt;</code><br />
<code>#include &lt;stdbool.h&gt;</code><br />
<code>#include &lt;stddef.h&gt;</code><br />
<code>#include &quot;<a class="el" href="fpc__bep__types_8h_source.html">fpc_bep_types.h</a>&quot;</code><br />
</div>
<p><a href="fpc__sensor__spi_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a6f07e0f8a500105af828f6574f282b92"><td class="memItemLeft" align="right" valign="top">typedef bool(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="fpc__sensor__spi_8h.html#a6f07e0f8a500105af828f6574f282b92">fpc_bep_wfi_check_t</a>) (void)</td></tr>
<tr class="memdesc:a6f07e0f8a500105af828f6574f282b92"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function that returns a bool deciding if WFI mode should be entered or not.  <a href="#a6f07e0f8a500105af828f6574f282b92">More...</a><br /></td></tr>
<tr class="separator:a6f07e0f8a500105af828f6574f282b92"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:aebf41e8e5f8e4af635136283c1863651"><td class="memItemLeft" align="right" valign="top"><a id="aebf41e8e5f8e4af635136283c1863651"></a>enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="fpc__sensor__spi_8h.html#aebf41e8e5f8e4af635136283c1863651">fpc_bep_spi_duplex_mode_t</a> { <br />
&#160;&#160;<b>FPC_BEP_SPI_FULL_DUPLEX</b> = 0, 
<br />
&#160;&#160;<b>FPC_BEP_SPI_HALF_DUPLEX</b> = 1
<br />
 }<tr class="memdesc:aebf41e8e5f8e4af635136283c1863651"><td class="mdescLeft">&#160;</td><td class="mdescRight">FPC sensor SPI modes. <br /></td></tr>
</td></tr>
<tr class="separator:aebf41e8e5f8e4af635136283c1863651"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a8863f62e7531ba270ae8fcae30ad747a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="fpc__bep__types_8h.html#adf46f9c3966202d9cf52a82981adaea4">fpc_bep_result_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="fpc__sensor__spi_8h.html#a8863f62e7531ba270ae8fcae30ad747a">fpc_sensor_spi_write_read</a> (uint8_t *data, size_t write_size, size_t read_size, bool leave_cs_asserted)</td></tr>
<tr class="memdesc:a8863f62e7531ba270ae8fcae30ad747a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes and reads SPI data.  <a href="#a8863f62e7531ba270ae8fcae30ad747a">More...</a><br /></td></tr>
<tr class="separator:a8863f62e7531ba270ae8fcae30ad747a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0330b0b1f58c340016e6bd403a9237c5"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="fpc__sensor__spi_8h.html#a0330b0b1f58c340016e6bd403a9237c5">fpc_sensor_spi_check_irq</a> (void)</td></tr>
<tr class="memdesc:a0330b0b1f58c340016e6bd403a9237c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read sensor IRQ status.  <a href="#a0330b0b1f58c340016e6bd403a9237c5">More...</a><br /></td></tr>
<tr class="separator:a0330b0b1f58c340016e6bd403a9237c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af00eb26e4dfd2a354d89fc281c383106"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="fpc__sensor__spi_8h.html#af00eb26e4dfd2a354d89fc281c383106">fpc_sensor_spi_read_irq</a> (void)</td></tr>
<tr class="memdesc:af00eb26e4dfd2a354d89fc281c383106"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read sensor IRQ status and then set status to false.  <a href="#af00eb26e4dfd2a354d89fc281c383106">More...</a><br /></td></tr>
<tr class="separator:af00eb26e4dfd2a354d89fc281c383106"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1d3250f59a2e50929ac1c10310dbdab0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="fpc__sensor__spi_8h.html#a1d3250f59a2e50929ac1c10310dbdab0">fpc_sensor_spi_reset</a> (bool state)</td></tr>
<tr class="memdesc:a1d3250f59a2e50929ac1c10310dbdab0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set sensor reset state.  <a href="#a1d3250f59a2e50929ac1c10310dbdab0">More...</a><br /></td></tr>
<tr class="separator:a1d3250f59a2e50929ac1c10310dbdab0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa5ebacf0a7cefecf27b08a47ba511760"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="fpc__sensor__spi_8h.html#aa5ebacf0a7cefecf27b08a47ba511760">fpc_sensor_spi_init</a> (uint32_t speed_hz)</td></tr>
<tr class="memdesc:aa5ebacf0a7cefecf27b08a47ba511760"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes SPI master.  <a href="#aa5ebacf0a7cefecf27b08a47ba511760">More...</a><br /></td></tr>
<tr class="separator:aa5ebacf0a7cefecf27b08a47ba511760"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a88ab296f9e86448906262deed2063aa8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="fpc__sensor__spi_8h.html#aebf41e8e5f8e4af635136283c1863651">fpc_bep_spi_duplex_mode_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="fpc__sensor__spi_8h.html#a88ab296f9e86448906262deed2063aa8">fpc_sensor_spi_get_duplex_mode</a> (void)</td></tr>
<tr class="memdesc:a88ab296f9e86448906262deed2063aa8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if HAL implements SPI in full duplex or half duplex mode.  <a href="#a88ab296f9e86448906262deed2063aa8">More...</a><br /></td></tr>
<tr class="separator:a88ab296f9e86448906262deed2063aa8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a38db7e8faa7af2006efee2f91ff0b9f7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="fpc__bep__types_8h.html#adf46f9c3966202d9cf52a82981adaea4">fpc_bep_result_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="fpc__sensor__spi_8h.html#a38db7e8faa7af2006efee2f91ff0b9f7">fpc_sensor_wfi</a> (uint16_t timeout_ms, <a class="el" href="fpc__sensor__spi_8h.html#a6f07e0f8a500105af828f6574f282b92">fpc_bep_wfi_check_t</a> enter_wfi, bool enter_wfi_mode)</td></tr>
<tr class="memdesc:a38db7e8faa7af2006efee2f91ff0b9f7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set system in WFI mode while waiting sensor IRQ.  <a href="#a38db7e8faa7af2006efee2f91ff0b9f7">More...</a><br /></td></tr>
<tr class="separator:a38db7e8faa7af2006efee2f91ff0b9f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Driver for SPI master. </p>
<p>Driver for SPI master. Intended for communication with fingerprint sensor. </p>
</div><h2 class="groupheader">Typedef Documentation</h2>
<a id="a6f07e0f8a500105af828f6574f282b92"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6f07e0f8a500105af828f6574f282b92">&#9670;&nbsp;</a></span>fpc_bep_wfi_check_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef bool(* fpc_bep_wfi_check_t) (void)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Function that returns a bool deciding if WFI mode should be entered or not. </p>
<dl class="section return"><dt>Returns</dt><dd>true enter WFI, false don't enter WFI </dd></dl>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a0330b0b1f58c340016e6bd403a9237c5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0330b0b1f58c340016e6bd403a9237c5">&#9670;&nbsp;</a></span>fpc_sensor_spi_check_irq()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool fpc_sensor_spi_check_irq </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Read sensor IRQ status. </p>
<p>Returns status of the sensor IRQ.</p>
<dl class="section return"><dt>Returns</dt><dd>true if the sensor IRQ is currently active, otherwise false. </dd></dl>

</div>
</div>
<a id="a88ab296f9e86448906262deed2063aa8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a88ab296f9e86448906262deed2063aa8">&#9670;&nbsp;</a></span>fpc_sensor_spi_get_duplex_mode()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="fpc__sensor__spi_8h.html#aebf41e8e5f8e4af635136283c1863651">fpc_bep_spi_duplex_mode_t</a> fpc_sensor_spi_get_duplex_mode </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Check if HAL implements SPI in full duplex or half duplex mode. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="fpc__sensor__spi_8h.html#aebf41e8e5f8e4af635136283c1863651" title="FPC sensor SPI modes. ">fpc_bep_spi_duplex_mode_t</a> </dd></dl>

</div>
</div>
<a id="aa5ebacf0a7cefecf27b08a47ba511760"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa5ebacf0a7cefecf27b08a47ba511760">&#9670;&nbsp;</a></span>fpc_sensor_spi_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void fpc_sensor_spi_init </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>speed_hz</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initializes SPI master. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">speed_hz</td><td>Maximum SPI clock speed according to sensor HW spec (unit Hz). </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="af00eb26e4dfd2a354d89fc281c383106"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af00eb26e4dfd2a354d89fc281c383106">&#9670;&nbsp;</a></span>fpc_sensor_spi_read_irq()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool fpc_sensor_spi_read_irq </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Read sensor IRQ status and then set status to false. </p>
<p>Returns status of the sensor IRQ and sets the status to false.</p>
<dl class="section return"><dt>Returns</dt><dd>true if the sensor IRQ has been active, otherwise false. </dd></dl>

</div>
</div>
<a id="a1d3250f59a2e50929ac1c10310dbdab0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1d3250f59a2e50929ac1c10310dbdab0">&#9670;&nbsp;</a></span>fpc_sensor_spi_reset()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void fpc_sensor_spi_reset </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>state</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set sensor reset state. </p>
<p>Set sensor reset state.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">state</td><td>Reset state. true =&gt; reset sensor, i.e. low GPIO state false =&gt; normal operation, i.e. high GPIO state </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a8863f62e7531ba270ae8fcae30ad747a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8863f62e7531ba270ae8fcae30ad747a">&#9670;&nbsp;</a></span>fpc_sensor_spi_write_read()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="fpc__bep__types_8h.html#adf46f9c3966202d9cf52a82981adaea4">fpc_bep_result_t</a> fpc_sensor_spi_write_read </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>write_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>read_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>leave_cs_asserted</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Writes and reads SPI data. </p>
<p>Writes data to SPI interface and reads data from SPI interface, with chip select control. The caller is blocked until the operation is complete. By use of the chip select control parameter a single SPI transaction can be split in several calls.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">data</td><td>Data buffer to write from, and read to. First part is data to be written (write_size). Following part is data to be read (read_size). Must be write_size + read_size long. The written data might be modified after call. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">write_size</td><td>Number of bytes to write from data buffer. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">read_size</td><td>Number of bytes to read. If write + read size is 0, the function still controls CS. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">leave_cs_asserted</td><td>True =&gt; chip select is left in asserted state. False =&gt; chip select is de-asserted before return. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="fpc__bep__types_8h.html#adf46f9c3966202d9cf52a82981adaea4" title="Common results returned by BEP functions. ">fpc_bep_result_t</a> </dd></dl>

</div>
</div>
<a id="a38db7e8faa7af2006efee2f91ff0b9f7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a38db7e8faa7af2006efee2f91ff0b9f7">&#9670;&nbsp;</a></span>fpc_sensor_wfi()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="fpc__bep__types_8h.html#adf46f9c3966202d9cf52a82981adaea4">fpc_bep_result_t</a> fpc_sensor_wfi </td>
          <td>(</td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>timeout_ms</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="fpc__sensor__spi_8h.html#a6f07e0f8a500105af828f6574f282b92">fpc_bep_wfi_check_t</a>&#160;</td>
          <td class="paramname"><em>enter_wfi</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>enter_wfi_mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set system in WFI mode while waiting sensor IRQ. </p>
<dl class="section note"><dt>Note</dt><dd>This mode only requires the system to be able to wake up from Sensor IRQ pin, all other peripheral can be turned off.</dd>
<dd>
The system time must be adjusted upon WFI return.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">timeout_ms</td><td>Time in ms before waking up, 0 if no timeout. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">enter_wfi</td><td>Function pointer to check WFI entry. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">enter_wfi_mode</td><td>Bool that is used when comparing the value returned by enter_wfi. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>FPC_BEP_RESULT_OK, FPC_BEP_RESULT_TIMEOUT </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_0d96f899f92a51a54f2a9daafded85a3.html">req_interface</a></li><li class="navelem"><a class="el" href="dir_2904bb0a4c7630347e1aab62443c90ca.html">inc</a></li><li class="navelem"><a class="el" href="fpc__sensor__spi_8h.html">fpc_sensor_spi.h</a></li>
    <li class="footer">Generated on Tue Nov 9 2021 12:12:59 for Biometric Embedded Platform by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
